﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;

namespace Gui.Web
{
    /// <summary>
    /// Summary description for JsonHandler
    /// </summary>
    public class JsonHandler : IHttpHandler
    {

        //public void ProcessRequest(HttpContext context)
        //{
        //    /*const string json = "{ theme: \"theme2\", title: { text: \"Datos desde ASP.NET\" }, data: [ " +
        //                        "{ type: \"stackedColumn\", toolTipContent: \"{label}<br/><span style='color: {color};'><strong>{name}</strong></span>: S/. {y}\", name: \"Enero\", showInLegend: \"false\", dataPoints: [{ y: 60.00, label: \"Omar\" }, { y: 40.00, label: \"Fredy\" } ] }, " +
        //                        "{ type: \"stackedColumn\", toolTipContent: \"{label}<br/><span style='color: {color};'><strong>{name}</strong></span>: S/. {y}\", name: \"Febrero\", showInLegend: \"false\", dataPoints: [{ y: 30.00, label: \"Omar\" }, { y: 40.00, label: \"Fredy\" }, { y: 90.00, label: \"Cesar\" } ] }, " +
        //                        "{ type: \"stackedColumn\", toolTipContent: \"{label}<br/><span style='color: {color};'><strong>{name}</strong></span>: S/. {y}\", name: \"Marzo\", showInLegend: \"false\", dataPoints: [{ y: 30.00, label: \"Omar\" }, { y: 40.00, label: \"Fredy\" } ] }, " +
        //                        "{ type: \"stackedColumn\", toolTipContent: \"{label}<br/><span style='color: {color};'><strong>{name}</strong></span>: S/. {y}\", name: \"Abril\", showInLegend: \"false\", dataPoints: [{ y: 130.00, label: \"Omar\" }, { y: 110.00, label: \"Fredy\" } ] } " + 
        //                        "] }";*/
        //    const string json = "{ theme: \"theme2\", title:{ text: \"Desde ASP.NET\" }, data: [ " +
        //                        "{ type: \"column\", dataPoints: [ { label: \"apple\", y: 10 }, " +
        //                        "{ label: \"orange\", y: 15 }, { label: \"banana\", y: 25 }," +
        //                        "{ label: \"mango\", y: 30 }, { label: \"grape\", y: 28 } ] } ] }";
        //    context.Response.ContentType = "text/json";
        //    context.Response.Write(json);
        //}


        public void ProcessRequest(HttpContext context)
        {
            /*var persona = new {Nombre = "Nombre", Apellido = "Apellido"};

            context.Response.ContentType = "application/json";
            context.Response.Write(JsonConvert.SerializeObject(persona));*/

            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");
        }

        public bool IsReusable { get { return false; } }
    }
}